package router

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"service/handler/device"
	"service/handler/emqhook"
)

func Startup(g *gin.Engine, mw ...gin.HandlerFunc) *gin.Engine {

	// 404 Handler.
	g.NoRoute(func(c *gin.Context) {
		c.String(http.StatusNotFound, "The incorrect API route.")
	})


	g.GET("/", func(context *gin.Context) {
		context.String(http.StatusOK, "Hello %s", "world")
	})

	g.POST("/webhook", emqhook.Monitor)



	g.POST("/register", device.Register)

	// The user handlers, requiring authentication
	//u := g.Group("/user")
	//	u.Use(middleware.AuthMiddleware())
	{
	//	u.POST("", user.Create)
		//	u.DELETE("/:id", user.Delete)
		//	u.PUT("/:id", user.Update)
		//	u.GET("", user.List)
	//	u.GET("/:username", user.Get)
	}

/*	svcd := g.Group("/sd")
	{
		svcd.GET("/health", sd.HealthCheck)
		svcd.GET("/disk", sd.DiskCheck)
		svcd.GET("/cpu", sd.CPUCheck)
		svcd.GET("/ram", sd.RAMCheck)
	}
*/
	return g
}